<?php
/**
 * Minhlog Minh_Resource 邮件资源类
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category   Minh
 * @package    Minh_Resource
 * @copyright  Copyright (c) 2009-2010 Minh.Shu Minh.Shu@gmail.com
 * @license    New BSD License
 * @author     Minh.Shu
 * @version    $Id: Mail.php 18 2010-01-30 08:30:35Z Minh.Shu $
 *
 */

class Minh_Resource_Mail extends Zend_Application_Resource_ResourceAbstract
{
    protected $_mail;

    public function init()
    {
        return $this->getMail();
    }

    /**
     * 获取邮件资源对象
     * @return $mail
     */
    public function getMail()
    {
        if(null === $this->_mail){
            $options = $this->getOptions();

            $mailTransport = new Zend_Mail_Transport_Smtp($options['smtp']['server'],$options['config']);
            Zend_Mail::setDefaultTransport($mailTransport);

            $this->_mail = $options;
        }
        return $this->_mail;
    }
}